package main

import (
	"fmt"
	"sync"
)

func main() {

	var wg = sync.WaitGroup{}
	ch := make(chan int)
	defer close(ch)
	var i int

	wg.Add(1)
	go func() {
		defer wg.Done()

		i = <- ch
		fmt.Println(i)
	}()
	ch <- 1
	wg.Wait()
}
